//
//  CZTranslateBaseCell.m
//  globalTranslate
//
//  Created by 陈镇 on 2025/8/12.
//

#import "CZTranslateBaseCell.h"

@implementation CZTranslateBaseCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
-(void)didInitializeWithStyle:(UITableViewCellStyle)style{
    [super didInitializeWithStyle:style];
    [self addSubview:self.headerView];
    self.backgroundColor = UIColorClear;
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
    [self.contentView sl_cornerRadius:10];
    
}
-(UIImageView *)headerView{
    if (!_headerView) {
        _headerView = [[UIImageView alloc] init];
        [_headerView sl_cornerRadius:2];

    }
    return _headerView;
}
-(void)layoutSubviews{
    [super layoutSubviews];
    if (self.model.isChinese) {
        _headerView.frame = CGRectMake(10, 2, 32, 32);
   
    }else{
        _headerView.frame = CGRectMake(self.width - 44 - 10, 2, 32, 32);
        
    }
}
-(void)setModel:(CZTranslateModel *)model{
    _model = model;
    _headerView.image = [UIImage imageNamed:model.head];
    
    if (model.isChinese) {
        self.contentView.backgroundColor = UIColorHex(#F6F4F7);
    }else{
        self.contentView.backgroundColor = UIColorHex(#D2F4FF);
    }
}
@end
